using System;
using System.Xml;
using Mehat.San.SanFS;

namespace Mehat.San.SanFS.Cache
{
	public class DummyCachePolicy : ICachePolicy
	{
		private	bool	mDebug = false;
		
		public DummyCachePolicy() {}
		
		public DummyCachePolicy(XmlNode CfgNode)
		{
			if (CfgNode.FirstChild.Value != "DummyCache")
				throw new Exception (String.Format("Expected 'DummyCache', got '{0}'", CfgNode.FirstChild.Value));
			
			mDebug = Convert.ToBoolean(CfgNode.FirstChild.Attributes.GetNamedItem("Debug").Value);
		}
		
		public ICachePolicy CreateInstance(XmlNode CfgNode)
		{
			return new DummyCachePolicy(CfgNode);
		}
		
		public void FlushFile(FileHandle Handle)
		{
			Handle.File.VMount.FlushFile(Handle);
		}
		
		public long ReadFile(FileHandle Handle, byte []Buffer, long Offset)
		{
			return Handle.File.VMount.ReadFile(Handle, Buffer, Offset);
		}
		
		public void ReleaseFile(FileHandle Handle)
		{
			Handle.File.VMount.ReleaseFile(Handle);
		}
		
		public void OpenFile(FileHandle Handle)
		{
			Handle.File.VMount.OpenFile(Handle);
		}
		
		public string PolicyName
		{
			get { return "Dummy"; }
		}
	}  // END CLASS
}  // END NAMESPACE
